<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>《系统工程》精品资源共享课——教学课件</title>
	<link rel="stylesheet" type="text/css" href="../css/bootstrap.min.css">
	<link rel="stylesheet" type="text/css" href="../css/common.css">
	<style type="text/css">
		main{
			
			width:90%;
			margin:0 auto;
			margin-bottom: 100px;
		}
		#catalog{
			margin:10px;
			background-color: white;
			border-radius: 8px;
			min-width:200px;
			height: 500px;
			padding:  0;
			overflow-y: scroll;
		}
		#catalog>ul>li{
			padding:25px 0px 20px 0px;
			cursor: pointer;
			font-size:16px;
			border-radius: 4px;
			margin:0;
		}
		#catalog li{
			width:100%;
			text-align: center;
		}
		.li-click{
			background-color:#2C2B2B;
			color:white;
		}
		#homework{
			border-radius: 8px;
			background-color: white;
			padding:30px;
			margin:10px;
			width:700px;
			min-height:480px;
		}
		#homework a{
			display: block;
			padding:10px 10px;
			font-size: 20px
		}
		#homework a  img{
			display: inline-block;
			margin:auto 10px;
		}
	</style>
</head>
<body>
	<div id="top">
		<img src="../image/huanonglogo.png" class="logo">
		<ul>
			<li class="userInfo hidden"><a href="userInformation.html">个人信息</a></li>
			<li><span id="user"></span></li>
			<li class="logout hidden"><a href="login.html">退出</a></li>
			<li id="login" class="login"><a href="login.html"><img src="../image/user.png"><span>登录</span></a></li>
		</ul>
	</div>
	<nav>
		<ul class="rows">
			<li class="col-md-2"><a href="../index.html">首页</a></li>
			<li class="dropdown col-md-2">
				<a href="#"  data-toggle="dropdown" class="dropdown-toggle">课程概要<span class="glyphicon glyphicon-chevron-down"></span></a>
				<ul class="dropdown-menu">
					<li><a href="primaryResource.html">教学大纲</a></li>
					<li><a href="primaryResource.html">教学日历</a></li>
					<li><a href="primaryResource.html">教学教材</a></li>
					<li><a href="primaryResource.html">参考资料</a></li>
					<li><a href="primaryResource.html">重点难点</a></li>
				</ul>
			</li>
			<li class="dropdown col-md-2">
				<a href="#"  data-toggle="dropdown" class="dropdown-toggle">课程资源<span class="glyphicon glyphicon-chevron-down"></span></a>
				<ul class="dropdown-menu">
					<li><a href="video.html">教学视频</a></li>
					<li><a href="ppt.html">教学课件</a></li>
					<li><a href="homework.html">作业</a></li>
				</ul>
			</li>
			<li class="col-md-2"><a href="courses.html">课程内容</a></li>
			<li class="col-md-2"><a href="expandingResource.html">拓展资源</a></li>
			<li class="col-md-2 hidden teacher_li"><a href="teacherCourseManagement.html">课程管理</a></li>
		</ul>

	</nav>
	<main class="rows">
		<section id="catalog" class="col-md-3 col-xs-8 col-lg-3">
			<ul>
				<!-- <li class="li-click">第1章 系统工程概述</li>
				<li>第2章 系统工程方法论</li>
				<li>第3章 系统模型与模型化</li>
				<li>第4章 系统仿真及系统动力学方法</li>
				<li>第5章 系统评价方法</li>
				<li>第6章 决策分析方法</li>
				<li>第7章 系统工程应用实例</li> -->
			</ul>
		</section>
		<section id="homework" class="col-md-8 col-xs-6 col-lg-7">
			<!-- <a href="../resource/Anli.ppt"><img src="../image/xiazai.png">系统工程应用案例</a> -->
		</section>
	</main>
	<footer>
		<p>版权所有：华南农业大学 数学与信息学院 软件学院</p>
	</footer>
	<script type="text/javascript" src="../js/jquery-3.2.1.min.js"></script>
	<script type="text/javascript" src="../js/bootstrap.min.js"></script>
	<script type="text/javascript" src="../js/common.js"></script>
	<script type="text/javascript">
		$(document).ready(function(){
			var sectionList;
			getAllSection();
			
		})

		$("#catalog ul").on("click","li",function(ev){
			var target=$(ev.target);
			var seId=target.attr('name');
			$("#homework").empty();
			for (var i = 0; i < sectionList.length; i++) {
				if(sectionList[i].seId==seId){
					let homeworkList =sectionList[i].homework;
					if(homeworkList.length==0){
						$("#homework").append('<a href="">该章节没有作业</a>');
					}else{
						for (var j = 0; j < homeworkList.length; j++) {
							let date=new Date(homeworkList[j].hModifytime);
	        				let modifyDate=date.getFullYear() + '-' +(date.getMonth()+1) + "-" + date.getDate() + " " +date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
							$("#homework").append('<a href="../resource/'+homeworkList[j].hName+'.doc"><img src="../image/xiazai.png">'+homeworkList[j].hName+'<span class="pull-right">更新时间：'+modifyDate+'</span></a>');
						}
					}
				}
				
				
			}
			target.addClass('li-click');
			target.siblings().removeClass('li-click');

		});

		function getAllSection(){
			var sectionNum;
			$.ajax({
				url: '/sectionController/queryAllSection',
				type: 'POST',
				success: function(data){
					sectionList=data;
					sectionNum=data.length;
					for(var i=0;i<sectionNum;i++){
						$("#catalog ul").append('<li name="'+data[i].seId+'">第'+data[i].seSeq+'章 '+data[i].seName+'</li>');
						
						if(data[i].seSeq==1){
							$("#catalog ul").find("li[name="+data[i].seId+"]").addClass('li-click');
							let hw=data[i].homework;
							if(hw.length==0){
								$("#homework").append('<a href="">该章节没有作业</a>');
							}else{
								for (var j = 0; j < hw.length; j++) {
									let date=new Date(hw[j].hModifytime);
	            					let modifyDate=date.getFullYear() + '-' +(date.getMonth()+1) + "-" + date.getDate() + " " +date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
									$("#homework").append('<a href="../resource/'+hw[j].hName+'.doc"><img src="../image/xiazai.png">'+hw[j].hName+'<span class="pull-right">更新时间：'+modifyDate+'</span></a>');
								}
							}
							
							
							
						}
						
					}
					
				}
				
			});
			
		}

		// function getAllHomework(){
		// 	$.ajax({
		// 		url: '/homeworkController/queryAllHomework',
		// 		type: 'POST',
		// 		success: function(data){
		// 			allHomeworkList=data;
		// 		}
				
		// 	});
			
		// }

		// function getHomeworkBySeId(seId){
		// 	var homeworkList=[];
		// 	for(var hw in allHomeworkList){
		// 		if(allHomeworkList[hw].seId==seId){
		// 			homeworkList.push(allHomeworkList[hw]);
		// 		}
		// 	}
		// 	return homeworkList;
		// }
			
	</script>
</body>
</html>